import { erqCategoryList, reqCategoryList } from "@/api";

export default {
  state: {
    categoryList: [],
  },
  mutations: {
    UPDATE_CATEGORYLIST(state, categoryList) {
      state.categoryList = categoryList;
    },
  },
  actions: {
    async getCategoryList({ commit }) {
      const result = await reqCategoryList();
      if (result.code == 200) {
        commit("UPDATE_CATEGORYLIST", result.data.slice(0, 15));
      }
    },
  },
  getters: {},
};
